# -*- coding: utf-8 -*-
"""
author:lili
date:20190425
produce item sim file
"""
import sys
sys.path.append('/home/lili/project/recommend/pyrcd/personal_recommendation')
import LR.util.test_cvs as tc
import LR.production.check as ck
import LR.production.ana_train_data as atd


def lrsort(recom_info,uid):
    itemidsstr = tc.recdic_to_str(recom_info[str(uid)])  # 字典提取itemid 字符串
    tc.test_data_cvs(uid, itemidsstr)  # 把测试集的itemid导出cvs
    #这里生成新的test测试集合，也应该生成新的预处理测试数据，test_file,bug,不应该和训练集在一起做预处理
    origin_train_data = "/home/lili/project/recommend/ll_newscms/public/data/lr/train.txt"
    origin_test_data = "/home/lili/project/recommend/ll_newscms/public/data/lr/test.txt"
    # train_data = "/home/lili/project/recommend/ll_newscms/public/data/lr/train_file"
    test_data = "/home/lili/project/recommend/ll_newscms/public/data/lr/test_file"
    atd.ana_train_data_test(origin_train_data,origin_test_data,test_data)

    recom_info = {}
    recom_info[str(uid)] = ck.web_return("/home/lili/project/recommend/ll_newscms/public/data/lr/test_file",
                                         "/home/lili/project/recommend/ll_newscms/public/data/lr/lr_coef",
                                         "/home/lili/project/recommend/ll_newscms/public/data/lr/lr_model",
                                         "/home/lili/project/recommend/ll_newscms/public/data/lr/feature_num")
    return recom_info